<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<title>{echo admin_title()}</title>
<!--header-->
{template _:header}
<style>
table.text-center th,table.text-center td{text-align: center;}
.bg-status-0{color:#666;background-color:#DDD;}
.bg-status-1{color:#FFF;background-color:#1E9FFF;}
.bg-status-2{color:#FFF;background-color:#1E9FFF;}
.bg-status-3{color:#FFF;background-color:#009688;}
/* .layui-tab-title{ background: #f2f2f2;}
.layui-tab-content{ padding:10px 0;}
.layui-tab .layui-this{ background: #fff;} */
</style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
<!--top-->
{template _main_top}
<!--nav-->
{template _main_nav}
	<div class="position">
		<h1>订单列表</h1>
	</div>
	<div class="layui-body admin-body">
		<div class="admin-content">
			<div class="searcher">
				<form name="sch_form" id="sch_form" method="get" action="{echo \befen\get_url()}">
					<div class="layui-input-inline" style="width: 190px;">
						<input type="text" name="out_trade_no" class="layui-input" value="{echo input('param.out_trade_no')}" placeholder="订单号">
					</div>
					<div class="layui-input-inline" style="width: 200px;">
						<input type="text" name="time_create" id="time_create" class="layui-input" placeholder="交易时间" value="{echo input('param.time_create')}">
					</div>
					<div class="layui-input-inline layui-left-margin"><button type="submit" id="search" class="layui-btn">查询</button></div>
				</form>
				<div class="clear"></div>
			</div>
			<div class="layui-tab" lay-filter="status">
				<ul class="layui-tab-title">
					<li <!--{if input('param.is_pay/s') === null}-->class="layui-this"<!--{/if}-->>全部</li>
					<li <!--{if input('param.is_pay/s') === '1'}-->class="layui-this"<!--{/if}-->>已付款</li>
					<li <!--{if input('param.is_pay/s') === '0'}-->class="layui-this"<!--{/if}-->>未付款</li>
				</ul>
				<div class="layui-tab-content">
					<div class="layui-tab-item layui-show">
						<table class="layui-table text-center" lay-skin="line">
							<thead>
								<tr>
									<th>订单号</th>
									<th>应付金额</th>
									<th>实付金额</th>
									<th>下单时间</th>
									<th>支付方式</th>
									<th>订单状态</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
								<!--{loop $list $key $val}-->
								<tr>
									<td>{$val[out_trade_no]}</td>
									<td>￥{$val[total_price]}</td>
									<td>￥{$val[pay_price]}</td>
									<td>{echo gsdate('Y-m-d H:i:s', $val[time_create])}</td>
									<td>{echo $val[trade_type] ? model('Order')->get_type($val[trade_type]) : '-'}</td>
									<td><span class="layui-badge bg-status-{$val[status]}">{echo model('Order')->getStatus($val['status'])}</span></td>
									<td class="op">
										<a href="{echo url('order/detail', ['order_id' => $val['order_id']])}" class="layui-btn layui-btn-xs layui-btn-normal">详情</a>
									</td>
								</tr>
								<!--{/loop}-->
							</tbody>
						</table>
						<div class="listpages">{$pagenav}</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--footer-->
{template _:footer}
<script>
layui.use('laydate', function(){
	var laydate = layui.laydate;
	laydate.render({ 
		elem: '#time_create',
		range: '~'
	});
});
layui.use('element', function(){
	var element = layui.element;
	element.on('tab(status)', function(data){
		switch(data.index){
			case 0:
			gotourl("{echo url('order/index')}");
				break;
			case 1:
			gotourl("{echo url('order/index', ['is_pay' => 1])}");
				break;
			case 2:
			gotourl("{echo url('order/index', ['is_pay' => 0])}");
				break;
		}
	});
});
</script>
</body>
</html>